// stores/counter.js
import { defineStore } from 'pinia'
import { userModel } from '../model/userModel';

const userBean: userModel = {
  id: -1,
  nickName: '',
  username: '',
  password: ''
}

export const userStore = defineStore('user', {
  state: () => {
    /**
     *
     *  id: 1,
        nickName: "admin"
        password: "123456"
        username: "root"
     */
    return { user: {...userBean} }
  },
  actions: {
    isLogin(): boolean {
      return this.user.id > 0;
    }
  }
})
